﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="adminLogin.aspx.cs" Inherits="yedian.login" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>夜店管理系统</title>
		<link rel="stylesheet" href="css/bootstrap.min.css" />
		<link rel="stylesheet" href="css/bootstrap-responsive.min.css" />
        <link rel="stylesheet" href="css/matrix-login.css" />
        <link href="font-awesome/css/font-awesome.css" rel="stylesheet" />
		<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,700,800' rel='stylesheet' type='text/css'>
    <script src="<%= Page.ResolveClientUrl("js/jquery-1.4.2.min.js") %>" type="text/javascript"></script>
    <script src="<%= Page.ResolveClientUrl("js/jquery-ui.js") %>" type="text/javascript"></script>
    <script src="<%= Page.ResolveClientUrl("js/AlertJs.js") %>" type="text/javascript"></script>
    <link href="<%= Page.ResolveClientUrl("css/ui-lightness/jquery-ui.css")%>" rel="stylesheet" type="text/css" />
        <script type="text/javascript">
            $(function () {

                $("#UserName").keyup(function () {
                    if (event.keyCode == 13) {
                        dl();
                    }
                });

                $("#UserPwd").keyup(function () {
                    if (event.keyCode == 13) {
                        dl();
                    }
                });

                $("#logins").click(function () {
                    dl();
                });
            });

            function dl() {
                var _UserName = $("#UserName").val();
                var _UserPwd = $("#UserPwd").val();
                var chkcode = $("#chkcode").val();
                if (chkcode == "" || chkcode == "") {
                    ShowDialog("验证码不能为空!");
                    return;
                }
                if (_UserName == "" || _UserName == null) {
                    ShowDialog("用户名称不能为空!");
                    return;
                }
                if (_UserPwd == "" || _UserPwd == null) {
                    ShowDialog("用户密码不能为空!");
                    return;
                }
                ShowProgress();
                $.ajax({
                    type: "POST",
                    url: "Handler.r",
                    dataType: "json",
                    async: false,
                    data: {
                        typename: "lgnadmin",
                        UserName: _UserName,
                        PassWord: _UserPwd,
                        yzm: chkcode
                    },
                    success: function (msg) {
                        HideProgress();
                        if (msg.success == "true") {
                            window.location.href = "AdminIndex.aspx";
                        }
                        else {
                            ShowDialog(msg.msg);
                        }
                    },
                    error: function (XMLHttpRequest, textStatus, errorThrown) {
                        HideProgress();
                        ShowDialog(textStatus);
                    }
                });
            }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
        <div id="loginbox">            
            <form id="loginform" class="form-vertical">
				 <div class="control-group normal_text"> <h3><img src="img/logo.png" alt="Logo" /></h3></div>
                <div class="control-group">
                    <div class="controls">
                        <div class="main_input_box">
                            <span class="add-on bg_lg"><i class="icon-user"></i></span><input id="UserName" type="text" placeholder="用户名" onFocus="this.select();" />
                        </div>
                    </div>
                </div>
                <div class="control-group">
                    <div class="controls">
                        <div class="main_input_box">
                            <span class="add-on bg_ly"><i class="icon-lock"></i></span><input id="UserPwd" onFocus="this.select();" type="password" placeholder="密码" />
                        </div>
                    </div>
                </div>
                <div class="control-group">
                    <div class="controls">
                        <div class="main_input_box">
                            <span class="add-on bg_ly"><i class="icon-lock"></i></span>&nbsp;&nbsp;<input name="chkcode" id="chkcode" style=" width:60%;"placeholder="验证码" />
                        <img id="ValidateImage" src="~/HandlerImage.r" zsrc="~/HandlerImage.r" onClick="this.src=this.getAttribute('zsrc')+'?t='+Math.random();" />
                        </div>
                    </div>
                </div>
                <div class="form-actions">
                    <span class="pull-right">
                        <input  class="btn btn-success"  name="logins" id="logins" type="button" value="立即登录" />
                    </span>
                </div>
            </form>
        </div>
        
    </div>
        <YD:AlertPage runat="server" ID="AlertPage" />
    </form>
</body>
</html>
